package com.clouddo.common.constants;

/**
 * @classDesc: 功能描述:(Json返回code类)
 * @author: xinjinlong
 * @date: 2018/12/16 12:23
 * @copyright (C), 2015-2018, 辰森世纪
 * @email: xjl@choicesoft.com.cn
 */
public enum StatusCode {

    /**
     * 成功
     */
    OK(20000,"成功"),

    /**
     * 失败
     */
    ERROR(20001,"失败"),

    /**
     * 用户名或密码错误
     */
    LOGIN_ERROR(20002,"用户名或密码错误"),

    /**
     * 权限不足
     */
    ACCESS_ERROR(20003,"权限不足"),

    /**
     * 远程调用失败
     */
    REMOTE_ERROR(20004,"远程调用失败"),

    /**
     * 重复操作
     */
    REP_ERROR(20005,"重复操作");

    private Integer code;
    private String info;

    StatusCode(Integer code, String info) {
        this.code = code;
        this.info = info;
    }

    public static StatusCode getValue(String code) {
        for (StatusCode status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        return null;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getInfo() {
        return info;
    }

    public void setInfo(String info) {
        this.info = info;
    }
}
